package com.cidp.system.dao.impl;

import com.cidp.system.dao.IDepartmentDao;
import com.cidp.system.model.Tdepartment;
import com.cidp.system.pojo.DepartmentPo;
import com.litt.core.dao.BaseDaoImpl;
import com.litt.core.page.IPageList;
import com.litt.core.page.PagePoParam;

/**
 * <b>标题：</b>系统部门DAO实现.
 * <pre><b>描述</b>
 *    系统部门管理
 * </pre>
 * 
 * @author lijian
 * @since 2008-5-27
 * @version 1.0
 */
public class DepartmentDaoImpl extends BaseDaoImpl implements IDepartmentDao {

	/**
	 * 读取系统部门信息
	 * 
	 * @param id
	 * @return Tdepartment 对象
	 */
	public Tdepartment loadDepartment(Long id){
		return (Tdepartment) super.loadObject(Tdepartment.class, id);
	}

	/**
	 * 删除系统部门信息
	 * 
	 * @param department
	 */
	public void deleteDepartment(Tdepartment department){
		super.deleteObject(department);
	}
	
	/**
	 * 更新系统部门信息
	 * 
	 * @param department
	 */
	public void updateDepartment(Tdepartment department){
		super.updateObject(department);
	}
	
	
	/**
	 * 保存系统部门信息
	 * 
	 * @param department
	 * @return Long 主键
	 */
	public Long saveDepartment(Tdepartment department){
		return super.saveObject(department);
	}
	
	/**
	 * 分页查询系统部门信息.
	 * 
	 * @param pagePoParam 查询参数
	 * @return IPageList IPageList对象
	 */
	public IPageList listByPage(PagePoParam pagePoParam) {
		DepartmentPo departmentPo = (DepartmentPo) pagePoParam.getConds();
		StringBuffer listHql = new StringBuffer("from Tdepartment where 1=1");
		StringBuffer listCountHql = new StringBuffer("select count(*) from Tdepartment where 1=1");
		return super.listHqlPage(listHql.toString(), listCountHql.toString(),pagePoParam.getPageIndex(), pagePoParam.getPageSize());
	}
	
}
